import { manzhanlistApi } from '../api'
// import * as TYPE from '../actionType/rankType'
import _ from 'lodash'

const state = {
	manzhanlist: []
}

const getters = {
	manzhanlist: state => state.manzhanlist
}

const actions = {
	manzhanlist({commit, state, rootState},{area,page}) {
		console.log({area,page})
		rootState.requesting = true
		commit('MANZHAN_LIST_REQUEST')
		manzhanlistApi.manzhanlist({area,page}).then((response) => {
			console.log({area,page})
			rootState.requesting = false
			commit('MANZHAN_LIST_SUCCESS', response)
		}, (error) => {
			rootState.requesting = false
			commit('MANZHAN_LIST_FAILURE')
		})
	}
}

const mutations = {
	['MANZHAN_LIST_REQUEST'] (state) {

	},
	['MANZHAN_LIST_SUCCESS'] (state, response) {
		state.manzhanlist = response.data
		
	},
	['MANZHAN_LIST_FAILURE'] (state) {

	}
}

export default {
	state,
	getters,
	actions,
	mutations
}